<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCategoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();
            $table->integer('pid')->unsigned()->nullable(false)->default(0)->comment('父id');
            $table->integer('lv')->unsigned()->nullable(false)->default(1)->comment('分类等级');
            $table->string('name')->nullable(false)->default('')->comment('分类名称');
            $table->string('img')->nullable(false)->default('')->comment('分类图片');
            $table->integer('sort')->unsigned()->nullable(false)->default(0)->comment('排序值,越小越靠前');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('category');
    }
}
